package com.yun.blog.config;

import com.google.code.kaptcha.servlet.KaptchaServlet;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * title        : KaptchaConfig
 * projectName  : dantouBlog-back
 * description  : 注册验证码servlet，前端请求得到验证码图片
 * author       : simple
 * date         : 2022/11/24下午4:36
 */

@Configuration
public class KaptchaConfig {
    @Bean
    public ServletRegistrationBean<KaptchaServlet> servletRegistrationBean(){
        ServletRegistrationBean<KaptchaServlet> bean = new ServletRegistrationBean<>();
        bean.setServlet(new KaptchaServlet());
        bean.addUrlMappings("/kaptcha");
        return bean;
    }
}
